package org.apache.servicecomb.samples.practise.houserush.sale.api;

import org.apache.servicecomb.samples.practise.houserush.sale.entity.Favorite;
import org.apache.servicecomb.samples.practise.houserush.sale.entity.HouseOrder;
import org.apache.servicecomb.samples.practise.houserush.sale.entity.Sale;
import org.apache.servicecomb.samples.practise.houserush.sale.entity.SaleQualification;
import org.springframework.web.bind.annotation.PathVariable;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import java.util.List;

public interface HouseOrderApi {
    List<Sale> indexSales();

    List<Sale> indexAllSales();

    Sale findSale(int saleId);

    List<Sale> findSaleByRealestateId(int realestateId);

    Sale createSale(Sale sale);

    Sale updateSale(int saleId, Sale sale);

    void removeSale(int saleId);

    //给前台客户抢房系统使用的接口 根据id查询开售活动
    Sale findOrderSale(@PathVariable int saleId);

    //    PUT 同步修改活动资格 sale_qualification
    void updateSaleQualification(List<SaleQualification> saleQualifications);


    //    DELETE 同步删除活动资格 sales/removeSaleQualification
    void removeSaleQualification(int customerId);

    //    GET 查询活动房源数量 sales/countBySaleId/{saleId}
    int countHouseBySaleId(int saleId);

    //    GET 根据客户id查询收藏 /favorites
    List<Favorite> findMyFavorite(int customerId);

    //    PUT 客户收藏房源 /house_orders/{houseOrderId}/add_favorite
    Favorite addFavorite(int customerId, int houseOrderId);

    //    DELETE 根据id删除收藏 /favorites/{id}
    void removeFavorite(int customerId, int id);

    //    GET 根据房源订单id查询房源订单 /house_orders/{houseOrderId}
    HouseOrder findOne(int houseOrderId);

    //    GET 根据房源id查询房源订单 /sales/findAllByHouseId/{houseId}
    HouseOrder findAllByHouseId(Integer houseId);

    //    GET 根据客户id查询该客户的所有房源订单 /sales/findAllByCustomerId
    List<HouseOrder> findAllByCustomerId(int cucustomerId);

    //    GET 前台首页活动查询 sales/list
    List<Sale> indexListSales(int customerId);

    //    sales/details/{saleId}
    List<Sale> indexDetailsSales(int customerId, int saleId);

    //    GET 后台活动订单查询 sales/indexOrderSales
    List<Sale> indexOrderSales();

    //    GET 活动资格查询 sales/findBySaleIdAndCustomerId/{saleId}
    SaleQualification findBySaleIdAndCustomerId(int saleId, int customerId);

    //    PUT 抢购房源 /house_orders/{saleId}/{houseOrderId}/{orderId}
    HouseOrder placeHouseOrder(int customerId, int saleId, int houseOrderId, int orderId);

    //    PUT 取消房源订单 /house_orders/{houseOrderId}/cancel/{orderId}
    HouseOrder cancelHouseOrder(int customerId, int houseOrderId, int orderId);
}
